﻿Imports NHibernate
Imports NHibernate.Cfg

Public Class SessionFactory
    Private Shared _sessionFactory As ISessionFactory

    Private Shared ReadOnly Property SessionFactory() As ISessionFactory
        Get
            If _sessionFactory Is Nothing Then
                Dim configuration = New Configuration()
                configuration.Configure()
                configuration.AddAssembly("NogalSGFM")
                _sessionFactory = configuration.BuildSessionFactory()
            End If
            Return _sessionFactory
        End Get
    End Property

    Public Shared Function OpenSession() As ISession
        Return SessionFactory.OpenSession()
    End Function
End Class


